package main;

import com.item.manager.Template;
import encounter.Combat;
import encounter.Encounter;
import monster.Monster;

public class CreatureTemplate implements Encounter {

    private final Template template;

    public CreatureTemplate(Template template) {
        this.template = template;
    }

    public String getName() {
        return template.name();
    }

    public int getCombat() {
        return template.findAttr("Combat").asInt();
    }

    public int getSpeed() {
        return template.findAttr("Speed").asInt();
    }
    
    public int getSpot() {
        return template.findAttr("Spot").asInt();
    }

    public int getMaxHealth() {
        return template.findAttr("MaxHealth").asInt();
    }

    public boolean resolve(Hero hero) {
        Monster enemy = new Monster(this);
        enemy.updateEnergy(-RandomProvider.roll(0.5));
        new Combat(hero, enemy).fight();
        return false;
    }
}
